//test/test.js
Page({
  // 点击发表评论
  data: {
    release: [{
      id: 1,
      name: 12,
      time:20180117,
      textareaValue:'dhusahid'
    },{
      id: 1,
      name: 12,
      time:20180117,
      textareaValue:'dhusahid'
    },{
      id: 1,
      name: 12,
      time:20180117,
      textareaValue:'dhusahid'
    },{
      id: 1,
      name: 12,
      time:20180117,
      textareaValue:'dhusahid'
    },]
  },
  formSubmit: function (e) {
    console.log('form发生了submit事件，携带数据为：', e.detail.value)
    if (e.detail.value.input == '') {
      wx.showToast({
        title: '请输入内容',
      })

    } else {
      var that = this;
      var textarea_item = {};
      var textareaValue = e.detail.value.input;

      var release = this.data.release;
      var id = release.length
      textarea_item.textareaValue = textareaValue;

      release.push(textarea_item); // 将评论内容添加到评论列表
      this.setData({
        release: release,
        releaseFocus: true, //隐藏输入框
        releaseValue: '' //清空输入框内容
      })
      console.log(release)


    }

  },
})